package net.cyue.nest.nestjava.common.interfaces.http;

import net.cyue.nest.nestjava.common.data.NestApplicationOption;
import net.cyue.nest.nestjava.common.data.http.CORSOption;
import net.cyue.nest.nestjava.common.enums.HTTPStatus;

public interface IHTTPServer {
  void use(IRequestHandler handler);
  void use(String path, IRequestHandler handler);
  void get(IRequestHandler handler);
  void get(String path, IRequestHandler handler);
  void post(IRequestHandler handler);
  void post(String path, IRequestHandler handler);
  void head(IRequestHandler handler);
  void head(String path, IRequestHandler handler);
  void delete(IRequestHandler handler);
  void delete(String path, IRequestHandler handler);
  void put(IRequestHandler handler);
  void put(String path, IRequestHandler handler);
  void patch(IRequestHandler handler);
  void patch(String path, IRequestHandler handler);
  void all(IRequestHandler handler);
  void all(String path, IRequestHandler handler);
  void options(IRequestHandler handler);
  void options(String path, IRequestHandler handler);

  void listen(int port);
  void listen(String port);

  void setErrorHandler(HTTPStatus status, IRequestHandler handler);
  void setNotFoundHandler(IRequestHandler handler);

  void initHTTPServer(NestApplicationOption option);
  void close();

  void enableCORS(CORSOption option);

}
